// hyb_yl/mysubpages/pages/docorder/docorder.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabitem: ['待接诊', '已接诊', '已结束', '已退回'],
    docindex: 0,
    page:0,
    pagesize:10,
    orderlist: [{
        'state': 0,
      },
      {
        'state': 1,
      },
      {
        'state': 2,
      },
      {
        'state': 3,
      }
    ],
    list:[],
    ifpay: 1 //已支付待接诊
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
   
    var zid = options.zid
    var openid = options.openid
    that.setData({
      zid: zid,
      openid:openid,
    })
    wx.setNavigationBarTitle({
      title: '电子病历'
    })
    // that.getOrder();
  },
  getOrder:function(){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/zhuanjia.all_userorder",
      data:{
        openid:that.data.openid,
        page:that.data.page,
        pagesize:that.data.pagesize,
      },
      success:function(res){
        var page = that.data.page + 1;
        that.setData({
          list:that.data.list.concat(res.data),
          page:page
        })
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this
    that.getOrder();
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    var that = this;
    that.getOrder();
  },
  getchar(e) {
    var that = this
    var id = e.currentTarget.dataset.id
    var zid = e.currentTarget.dataset.zid
    var typedate = e.currentTarget.dataset.typedate
    var key_words = e.currentTarget.dataset.key_words
    var j_id = e.currentTarget.dataset.j_id
    var back_orser = e.currentTarget.dataset.back_orser
    var openid = e.currentTarget.dataset.openid
    var overtime = e.currentTarget.dataset.overtime
    var ifpay = e.currentTarget.dataset.ifpay
    var docindex = that.data.docindex
    wx.navigateTo({
      url: '/hyb_yl/zhuanjiasubpages/pages/zhuanjiahuida/zhuanjiahuida?id=' + id + '&zid=' + zid + '&typedate=' + typedate + '&key_words=' + key_words + '&j_id=' + j_id + '&back_orser=' + back_orser + '&openid=' + openid + '&overtime=' + overtime + '&ifpay=' + ifpay + '&docindex=' + docindex+'&suc=suc',
    })
  },
})